package com.example.goodpet.activity;

import static com.amap.api.services.core.ServiceSettings.updatePrivacyAgree;
import static com.amap.api.services.core.ServiceSettings.updatePrivacyShow;

import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.amap.api.maps2d.MapsInitializer;
import com.example.goodpet.R;
import com.example.goodpet.activity.Fragment.HospitalInfoFragment;
import com.example.goodpet.activity.Fragment.MainChannelFragment;
import com.example.goodpet.base.BaseFragment;
import com.example.goodpet.utils.ActivityManager;
import com.example.goodpet.utils.MyApplication;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;


public class PetHospitalActivity extends FragmentActivity{


    private TextView title;


    private BaseFragment fragment;
    private ImageView back;
    private String TAG=this.getClass().getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pet_hospital);
        initView();
        updatePrivacyShow(this,true,true);
        updatePrivacyAgree(this,true);
        UltimateBarX.statusBarOnly(this)
                .fitWindow(true)
                .colorRes(R.color.ic_back_background)
                .light(true)
                .apply();
        ActivityManager.getInstance().addActivity(this);
        initFragment();

        initListener();
    }

    private void initFragment() {
        fragment=new HospitalInfoFragment();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        if(!fragment.isAdded()){
            transaction.add(R.id.fragment,fragment);
            transaction.commit();
        }
    }

    private void initView() {
        back=findViewById(R.id.titlebar_common_back);
        title=findViewById(R.id.titlebar_common_title);
        title.setText("宠物医疗");
    }

    private void initListener() {
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

}